
public class algs02 {

	public static long searchN(long x){
		long N = 1;
		while(N < x)
			N = N * 10;
		if(N > 1)
			N = N / 10;
		
		return N;
	}
	public static long searchT(long x){
		long T = 0;
		for(int N = 1; N < x; N=N*10){
			T++;
		}
		return T;
	}
	public static void main(String[] args) {
		long a = 123456789;
		long b = 987456321;
		long min;
		long max;
		if (a < b)
			min = a;
		else
			min = b;
		if(a < b)
			max = b;
		else
			max = a;
		long n = searchN(min);
		long t = searchT(min);
		long Mult = 0;
		while(t > 0){
			Mult = (Mult + max*(min/n))*n;
			min = min - (min/n)*n;
			n = searchN(min);
			t--;
			System.out.println(Mult);
		}
		
	}

}
